﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lamex.SIESystemManager.Calculate
{
    public class C_D54
    {
        public double GetD54(DataRow[] dr1, DataRow[] dr2)
        {
            double TD54 = 0;
            double D54_Kind_of_Kitting = 0;
            //单位工时
            double WD54_Kind_of_Kitting = 0;
            //附加工时
            double AD54_Kind_of_Kitting = 0;
            //获取数据库每个工序动作的单位工时和附加工时
            foreach (var drHours in dr2)
            {
                switch (drHours["OPERATIONAL_NAME"].ToString())
                {
                    case "配件种类":
                        WD54_Kind_of_Kitting = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD54_Kind_of_Kitting = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                }
            }
            //特征值
            foreach (var drData in dr1)
            {
                D54_Kind_of_Kitting = double.Parse(string.IsNullOrEmpty(drData["D54_Kind_of_Kitting"].ToString()) ? "0" : drData["D54_Kind_of_Kitting"].ToString());
            }
            //工时计算
            if (D54_Kind_of_Kitting != 0)
                TD54 = D54_Kind_of_Kitting * WD54_Kind_of_Kitting;
            return TD54;
        }
    }
}
